(ns MyBot3
  (:require
   [game :refer [single-dimension-distance frontier board-half board-rows board-cols overkill-direction]]
   [io]
   [utils :refer :all])  
  (:gen-class))

(def bot-name "MyBot3")


(defn make-move [game-map]
  (fn [{:keys [owner production strength] :as mysite}]
    (let []
      [mysite :still])))

(defn- game-map-to-mysites [game-map my-id]
  (->> game-map flatten (filter #(= my-id (:owner %)))))

(defn -main []
  (let [{:keys [my-id productions width height game-map] :as init-data} (io/get-init!)]
    (log "Start testing")
    (reset! board-rows (count game-map))
    (reset! board-cols (count (first game-map)))
    (reset! board-half (/ (+ @board-rows @board-cols) 2))
    (reset! frontier [])
    (log "board info:" @board-rows @board-cols @board-half)
    (println bot-name)

    (doseq [turn (range)]
      (let [game-map (io/create-game-map width height productions (io/read-ints!))
            mysites (game-map-to-mysites game-map my-id)
            mover (make-move game-map)]
        (io/send-moves! (map mover mysites))))))
